CC:=gcc
CFLAGS := -g -O0 -Wall  # 添加调试信息并禁用优化

log:= thirdparty/log.c thirdparty/log.h

json:= thirdparty/cJSON.c thirdparty/cJSON.h

common:= app/app_common.c app/app_common.h

message:= app/app_message.c app/app_message.h

mqtt:= app/app_mqtt.c app/app_mqtt.h

test_log: test/test_log.c $(log)
	$(CC) -o $@ $^ -Ithirdparty
	./$@
	rm -f $@

test_json: test/test_json.c $(json)
	$(CC) $(CFLAGS) -o $@ $^ -Ithirdparty
#	./$@
#	rm -f $@

test_common: test/test_common.c $(common)
	$(CC) $(CFLAGS) -o $@ $^ -Iapp
	./$@
	rm -f $@

message:  test/test_message.c $(message) $(common) $(json)
	$(CC) $(CFLAGS) -o $@ $^ -Iapp -Ithirdparty
	./$@
	rm -f $@

test_mqtt:  test/test_mqtt.c $(mqtt)   $(log)
	-$(CC) $(CFLAGS) -o $@ $^ -Iapp  -Ithirdparty -lpaho-mqtt3c
	-./$@
	rm -f $@